package com.framework;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class BeanFactory {
    private  Map<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<>();

    public Object getBean(String beanName) {
        //这里获取的是BeanDefinition中的bean对象，而不是BeanDefinition 这个大的对象
        return beanDefinitionMap.get(beanName).getBean();
    }

    public void registryBeanDefinition(String beanName, BeanDefinition beanDefinition) {
        beanDefinitionMap.put(beanName, beanDefinition);
    }
}
